package com.example.multithread;

class MyThread3 implements Runnable {
    private int ticket = 50;

    @Override
    public void run() {
        while (this.ticket > 0) {
            if (this.ticket > 0) {
                System.out.println("【卖票】 ticket = " + this.ticket--);
            }
        }
    }
}

public class ThreadAndRunaable {
    public static void main(String[] args) {
        MyThread3 t = new MyThread3();
        Thread thread = new Thread(t);
        Thread thread2 = new Thread(t);
        Thread thread3 = new Thread(t);
        Thread thread4 = new Thread(t);
        Thread thread5 = new Thread(t);
        thread.start();
        thread2.start();
        thread3.start();
        thread4.start();
        thread5.start();
    }
}
